
def toInt(arg):
    return int(arg)

input = open('input.in')
CASES = int(input.readline())
for case in range(1,CASES+1):
    credit = int(input.readline())
    itemN = int(input.readline())
    items = map(toInt,input.readline().split(' '))
    values = {}
    ans = 'Case #%d: '%case
    for ind in range(len(items)):
        find = credit - items[ind]
        if find in values:
            ans+= str(values[find]+1)+' '+str(ind+1)
            break
        values[items[ind]] = ind
    print ans
        

